home *** CD-ROM | disk | FTP | other *** search
/ PsL Monthly 1993 December / PSL Monthly Shareware CD-ROM (December 1993).iso / prgmming / dos / asm / mtype.com / MTYPE.ASM next >
Encoding:
Assembly Source File  |  1989-01-15  |  2.0 KB  |  122 lines

  1. ;MTYPE.ASM --
  2. ;Test for the presence of an active Color/Monochrome EGA/VGA.
  3.  
  4. cr    equ    13
  5.  
  6. lf    equ    10
  7.  
  8. B_RAM    segment at 40h
  9.         org    87h
  10.         info    db    ?
  11.         
  12. B_RAM    ends
  13.  
  14. data    segment public
  15.     no_support    db    'The required EGA or VGA is not active',cr,lf
  16.     clr_ega        db    'You have an active color EGA',cr,lf
  17.     clr_vga        db    'You have an active color VGA',cr,lf
  18.     mono_ega    db    'You have an active monochrome EGA',cr,lf
  19.     mono_vga    db    'You have an active monochrome VGA',cr,lf
  20.     
  21. data    ends
  22.  
  23. code    segment public
  24.         assume    CS:code
  25.         
  26. main    proc    far
  27.  
  28. start:    push    DS
  29.         sub    AX,AX
  30.         push    AX
  31.         
  32.         mov    AX,data
  33.         mov    DS,AX
  34.         assume    DS:data
  35.         
  36.         mov    AX,1a00h    ;function 1a return display code
  37.         int    10h            ;AL will return as 1a if supported
  38.         
  39.         cmp    AL,1ah
  40.         jne    no_dc
  41.         
  42.         cmp    BL,7        ;Is it a monochrome VGA?
  43.         je    mono_v
  44.         
  45.         cmp    BL,8        ;Is it a color VGA?
  46.         je    color_v
  47.         
  48.         mov    BL,4        ;Is it a color EGA?
  49.         je    color_e
  50.         
  51.         mov    BL,5        ;Is it a monochrome EGA?
  52.         je    mono_e
  53.         
  54.  
  55. no_dc:
  56.         mov    AH,12h    ;Get information
  57.         mov    BL,10h    ;about the EGA
  58.         int    10h
  59.         cmp    BL,10h    ;did it come back as 10h (no EGA)?
  60.         je    invalid    ;yes, ship next test
  61.         
  62.         push    DS
  63.         mov    AX,B_RAM    ;BIOS RAM area
  64.         mov    DS,AX
  65.         assume    DS:B_RAM
  66.         mov    BL,info    ;get information byte
  67.         
  68.         pop    DS
  69.         assume    DS:DATA
  70.         
  71.  
  72.         test    BL,8        ;is the EGA active
  73.         jz    valid        ;bit 3=0 means EGA active
  74.         
  75. invalid:
  76.         mov    BX,offset no_support
  77.         jmp    finish
  78.         
  79. valid:
  80.         cmp    BH,1        ;is monitor type monochrome?
  81.         je    mono_e
  82.         jmp    color_e
  83.         
  84. mono_v:
  85.         mov    BX,offset mono_vga
  86.         jmp    finish
  87.         
  88. color_v:
  89.         mov    BX,offset clr_vga
  90.         jmp    finish
  91.         
  92. color_e:
  93.         mov    BX,offset clr_ega
  94.         jmp    finish
  95.         
  96. mono_e:
  97.         mov    BX,offset mono_ega
  98.         jmp    finish
  99.         
  100. finish:
  101.         call    print_msg
  102.  
  103.         ret
  104.         
  105. main    endp
  106.  
  107. print_msg    proc    near
  108.  
  109. next_char:
  110.         mov    dl,[bx]    ;put it in dl
  111.         mov    ah,2        ;write to screen
  112.         int    21h        ;DOS call
  113.         inc    bx
  114.         cmp    dl,10        ;line feed?
  115.         jne    next_char    ;no, get next character
  116.         
  117.         ret
  118.         
  119. print_msg    endp
  120. code        ends
  121. end        start
  122.